package com.allo2o.common.convertor;

import com.allo2o.common.VO.MerchantCommodityVO;
import com.allo2o.common.domain.MerchantCommodityDO;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Bean;

/**
 * <ul>
 * CommodityConvertor
 * </ul>
 * Created by lubingbing on 16-5-10.
 */
public class CommodityConvertor {

    /**
     * <ul>
     * convert MerchantCommodityVO 2 MerchantCommodityDO
     * </ul>
     *
     * @param vo MerchantCommodityVO
     * @return MerchantCommodityDO
     */
    public static MerchantCommodityDO VO2DOConvert(MerchantCommodityVO vo) {
        if (vo == null) {
            return null;
        }
        MerchantCommodityDO dto = new MerchantCommodityDO();
        BeanUtils.copyProperties(vo, dto);
        return dto;
    }

    /**
     * <ul>
     * convert MerchantCommodityDO 2 MerchantCommodityVO
     * </ul>
     *
     * @param dto MerchantCommodityDO
     * @return MerchantCommodityVO
     */
    public static MerchantCommodityVO DO2VOConvert(MerchantCommodityDO dto) {
        if(dto == null) {
            return null;
        }
        MerchantCommodityVO vo = new MerchantCommodityVO();
        BeanUtils.copyProperties(dto, vo);
        return vo;
    }

}
